//
//  ChatRoomCell.m
//  WanCaiC8
//
//  Created by tangang on 2018/4/2.
//  Copyright © 2018年 tangang. All rights reserved.
//

#import "ChatRoomCell.h"

@implementation ChatRoomCell{
    UIImageView *imageV;
    QXLable     *labTitle;
}

- (instancetype)initWithFrame:(CGRect)frame{
    if (self=[super initWithFrame:frame]) {
        UIView  *bgView=[[UIView alloc]init];
        bgView.layer.masksToBounds=YES;
        bgView.layer.borderWidth=.7;
        bgView.layer.cornerRadius=10;
        bgView.layer.borderColor=DEFAULTLINECOLOR.CGColor;
        [self.contentView addSubview:bgView];
        [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(self.contentView).with
            .insets(UIEdgeInsetsMake(5, 5, 5, 5));
        }];
        
        imageV=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"06_11"]];
        [bgView addSubview:imageV];
        [imageV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(bgView);
            make.centerY.equalTo(bgView).with.offset(-10);
            make.size.mas_equalTo(CGSizeMake(real_size(50), real_size(50)));
        }];
        
        labTitle=[[QXLable alloc]initCenterTextWithText:@"综合聊天室"];
        labTitle.font=[UIFont systemFontOfSize:13];
        [bgView addSubview:labTitle];
        [labTitle mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(imageV.mas_bottom);
            make.left.right.bottom.equalTo(bgView);
        }];
        
    }
    return self;
}

- (void)setModel:(RoomModel *)model{
    labTitle.text=model.Name;
    [imageV sd_setImageWithURL:[NSURL URLWithString:model.LogoPath] placeholderImage:[UIImage imageNamed:@"chat_icon"]];
}

@end
